home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1995 October / EnigmA AMIGA RUN 01 (1995)(G.R. Edizioni)(IT)[!][issue 1995-10][Aminet 7].iso / Aminet / comm / mail / thor201.lha / THOR_2.0 / thor.lha / rexx / KeepMsg.thor < prev    next >
Text File  |  1995-05-15  |  3KB  |  96 lines

  1. /*
  2. ** $VER: KeepMsg.thor 1.1 (24.2.95) Eirik Synnes
  3. **
  4. ** Copies the current message to a 'Keep' conference and sets the KEEP flag
  5. ** Specify the conference name in the toconf string below. If the conference
  6. ** doesn't exist it will be created.
  7. **
  8. ** New in 1.1:
  9. **
  10. ** o Supports hazelevels
  11. **
  12. */
  13.  
  14. options results
  15.  
  16. toconf = 'The Keep'
  17.  
  18. CDF_NOT_ON_BBS   = '00008000'x  /* This conference is not on the bbs. */
  19.  
  20. /* Open Thor and BBSREAD ARexx ports' */
  21.  
  22. p=address()||' '||show('P',,);if pos('THOR.',p)>0 then thorport=word(substr(p,pos('THOR.',p)),1);else do;say 'No THOR port found!';exit(0);end
  23. if ~show('p', 'BBSREAD') then do; address command; "run >nil: `GetEnv THOR/THORPath`bin/LoadBBSRead"; "WaitForPort BBSREAD"; end
  24.  
  25. address(thorport)
  26. trace off; CURRENTMSG curmsg; trace on
  27.  
  28. if rc ~= 0 then do
  29.  REQUESTNOTIFY '"'THOR.LASTERROR'"' '"_Abort"'
  30.  exit(0)
  31.  end
  32.  
  33. address(bbsread)
  34. READBRMESSAGE '"'curmsg.BBSNAME'"' '"'curmsg.CONFNAME'"' '"'curmsg.MSGNR'"' TEXTSTEM text HEADSTEM head DATASTEM data
  35. if rc ~= 0 then do
  36.  address(thorport)
  37.  REQUESTNOTIFY '"'BBSREAD.LASTERROR'"' '"_Abort"'
  38.  exit(0)
  39.  end
  40.  
  41. if head.fromname        ~= "HEAD.FROMNAME"        then text.fromname        = head.fromname
  42. if head.fromaddr        ~= "HEAD.FROMADDR"        then text.fromaddr        = head.fromaddr
  43. if head.toname          ~= "HEAD.TONAME"          then text.toname          = head.toname
  44. if head.toaddr          ~= "HEAD.TOADDR"          then text.toaddr          = head.toaddr
  45. if head.msgid           ~= "HEAD.MSGID"           then text.msgid           = head.msgid
  46. if head.refid           ~= "HEAD.REFID"           then text.refid           = head.refid
  47. if head.creationdate    ~= "HEAD.CREATIONDATE"    then text.creationdate    = head.creationdate
  48. if head.creationdatetxt ~= "HEAD.CREATIONDATETXT" then text.creationdatetxt = head.creationdatetxt
  49. if head.subject         ~= "HEAD.SUBJECT"         then text.subject         = head.subject
  50.  
  51. if text.TEXT.COUNT = 0 then do
  52.  address(thorport)
  53.  REQUESTNOTIFY '"'No message body.'"' '"'_Ok'"'
  54.  exit(0)
  55.  end
  56.  
  57. text.replyconf = curmsg.CONFNAME
  58.  
  59. priv = ""; urg = ""; imp = ""
  60.  
  61. if bittst(data.flags,2) then priv = "PRIVATE"
  62. if bittst(data.flags,11) then urg = "URGENT"
  63. if bittst(data.flags,12) then imp = "IMPORTANT"
  64.  
  65. WRITEBRMESSAGE '"'curmsg.BBSNAME'"' '"'toconf'"' STEM text priv urg imp
  66. if rc ~= 0 then do
  67.  errmsg = BBSREAD.LASTERROR
  68.  if errmsg = 'Unknown conference' then do
  69.   CONFIGCONF '"'curmsg.BBSNAME'"' '"'toconf'"' SET c2x(CDF_NOT_ON_BBS)
  70.   WRITEBRMESSAGE '"'curmsg.BBSNAME'"' '"'toconf'"' STEM text priv
  71.   if rc ~= 0 then do
  72.    address(thorport)
  73.    REQUESTNOTIFY '"Couldn''t write message:\n'errmsg'"' '"_Ok"'
  74.    exit(0)
  75.    end
  76.   end
  77.  else do
  78.   address(thorport)
  79.   REQUESTNOTIFY '"Couldn''t write message:\n'errmsg'"' '"_Ok"'
  80.   exit(0)
  81.   end
  82.  end
  83.  
  84. mnr = result
  85. repl = ""
  86. if bittst(data.flags, 1) then repl = "SETREPLIED"
  87.  
  88. address(bbsread)
  89. UPDATEBRMESSAGE '"'curmsg.BBSNAME'"' '"'toconf'"' mnr SETKEEP repl HAZELEVEL data.HAZELEVEL
  90. if rc ~= 0 then do
  91.  address(thorport)
  92.  REQUESTNOTIFY '"Couldn''t update message:\n'BBSREAD.LASTERROR'"' '"_Ok"'
  93.  end
  94.  
  95. exit(0)
  96.